package com.sntk.organauthomanager.infrastructure.commit.impl;

import com.alibaba.fastjson.JSON;
import com.sntk.organauthomanager.application.dto.ResponseData;
import com.sntk.organauthomanager.infrastructure.commit.MedicalUserCommit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import java.util.List;

@Component("medicalUserCommitConvert")
public class MedicalUserCommitConvert {

    @Autowired
    private MedicalUserCommit medicalUserCommit;

    /**
     * 查询体检系统机构下已分配的登录账号列表
     * @param institutionNumber
     * @return
     */
    public List<String> searchAllocationUsers(String institutionNumber){
        ResponseData<List<String>> responseData = medicalUserCommit.searchAllocationUsers(institutionNumber);
        if(!responseData.getCode().equals("200")){
            return null;
        }
        if(ObjectUtils.isEmpty(responseData.getData())){
            return null;
        }
        return responseData.getData();
    }

}
